package com.hung.thread.synchronized_test;

public class AgainLockTestDemo
{
    public static void main(String[] args)
    {
        Thread t = new Thread(new Runnable()
        {
            @Override
            public void run()
            {
                AgainLock al = new AgainLock();
                al.print1();
            }
        });
        t.start();
    }
    static class AgainLock
    {
        public synchronized void print1()
        {
            System.out.println("do work print1");
            print2();
            System.out.println("do work print1 after ");
        }

        public synchronized void print2()
        {
            System.out.println("do work print2");
            print3();
            System.out.println("do work print2 after ");
        }

        public synchronized void print3()
        {
            System.out.println("do work print3");
            System.out.println("do work print3 after ");
        }
    }
}